export function formDatRouter(routers) {
  let _routers = []
  routers.forEach(route => {
    let {
      id,
      path,
      component,
      name,
      meta,
      hidden,
      redirect,
      children
    } = route
    if (children && children.length) {

      children = formDatRouter(children)
    }
    // let _route =
    _routers.push({
      id,
      path: path,
      component: r =>
        require.ensure([], () =>
          r(require(`project/admin/views/${component}`))
        ),
      // component(resolve) {
      //   require([`project/admin/views/${component}`], resolve)
      // },
      name: name,
      meta: meta,
      hidden: hidden,
      redirect: redirect,
      children: children
    })
  });
  return _routers
}
